import 'package:flutter/material.dart';
import 'package:flutter01/global.dart';
import 'package:flutter01/page/widget/Dismissible.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:hexcolor/hexcolor.dart';

class WidgetPage extends StatelessWidget {
  const WidgetPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var _widgetNameList = ["DismissiblePage"];
    return Container(
      color: HexColor("#EEEEEE"),
      padding: EdgeInsets.all(10),
      child: GridView.builder(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: Global.WHS ? 12 : 4,
          mainAxisSpacing: 9.sp,
          crossAxisSpacing: 9.sp,
        ),
        itemCount: _widgetNameList.length,
        itemBuilder: (BuildContext context, int index) {
          var item = _widgetNameList[index];
          return InkWell(
            child: Container(
              alignment: Alignment.center,
              decoration: BoxDecoration(
                color: Colors.black,
                borderRadius: BorderRadius.all(Radius.circular(20)),
              ),
              child: Text(
                "$item",
                style: TextStyle(color: Colors.white, fontSize: 12.sp),
              ),
            ),
            onTap: () {
              switch (item) {
                case "DismissiblePage":
                  Navigator.push(context, MaterialPageRoute(builder: (context) => DismissiblePage()));
                  break;
                default:
              }
            },
          );
        },
      ),
    );
  }
}
